package com.henu.art.model;

import com.henu.art.entity.AcademicOrigin;
import com.henu.art.entity.Teacher;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class UserDetailModel {
    private String id;
    private String name;
    private String gender;
    private String birthDate;
    private String entryDate;
    private String employmentStatus;
    private String unitCode;
    private String unitName;
    private String education;
    private String highestDegree;
    private String academicOrigin;
    private String professionalTitle;
    private String subjectCategory;
    private String politicalStatus;
    private String nationality;
    private String teachingType;
    private String majorName;
    private String majorCode;
    private String password;
    private int teachingYears;
    private String isLabTech;
    private String isDoubleQualified;
    private String hasEngineeringBg;
    private String hasIndustryBg;
    private String hasOverseasExp;
    private String isOutstandingIdeological;
    private String phone;
    private String emergencyContacts;
    private String emergencyPhone;
    private String idcard;
    private String shenfen;
    private String address;

    private String professionalLevel;
    private String zhiwu;
    private String dazhuan;
    private String dazhuanMajor;
    private String benke;
    private String benkeMajor;
    private String benkeLevel;
    private String shuoshi;
    private String shuoshiMajor;
    private String shuoshiLevel;
    private String phd;
    private String phdMajor;
    private String phdLevel;
    private String afterphd;
    private String afterphdLevel;

    public static UserDetailModel fromTeacherAndAcademicOrigin(Teacher teacher, AcademicOrigin academicOrigin) {
        UserDetailModel model = new UserDetailModel();
        // 映射 Teacher 字段
        model.setId(teacher.getId());
        model.setName(teacher.getName());
        model.setGender(teacher.getGender());
        model.setBirthDate(teacher.getBirthDate());
        model.setEntryDate(teacher.getEntryDate());
        model.setEmploymentStatus(teacher.getEmploymentStatus());
        model.setUnitCode(teacher.getUnitCode());
        model.setUnitName(teacher.getUnitName());
        model.setEducation(teacher.getEducation());
        model.setHighestDegree(teacher.getHighestDegree());
        model.setAcademicOrigin(teacher.getAcademicOrigin());
        model.setProfessionalTitle(teacher.getProfessionalTitle());
        model.setSubjectCategory(teacher.getSubjectCategory());
        model.setPoliticalStatus(teacher.getPoliticalStatus());
        model.setNationality(teacher.getNationality());
        model.setTeachingType(teacher.getTeachingType());
        model.setMajorName(teacher.getMajorName());
        model.setMajorCode(teacher.getMajorCode());
        model.setPassword(teacher.getPassword());
        model.setTeachingYears(teacher.getTeachingYears());
        model.setIsLabTech(teacher.getIsLabTech());
        model.setIsDoubleQualified(teacher.getIsDoubleQualified());
        model.setHasEngineeringBg(teacher.getHasEngineeringBg());
        model.setHasIndustryBg(teacher.getHasIndustryBg());
        model.setHasOverseasExp(teacher.getHasOverseasExp());
        model.setIsOutstandingIdeological(teacher.getIsOutstandingIdeological());
        model.setPhone(teacher.getPhone());
        model.setEmergencyContacts(teacher.getEmergencyContacts());
        model.setEmergencyPhone(teacher.getEmergencyPhone());
        model.setIdcard(teacher.getIdcard());
        model.setShenfen(teacher.getShenfen());
        model.setAddress(teacher.getAddress());

        // 映射 AcademicOrigin 字段
        if (academicOrigin != null) {
            model.setProfessionalLevel(academicOrigin.getProfessionalLevel());
            model.setZhiwu(academicOrigin.getZhiwu());
            model.setDazhuan(academicOrigin.getDazhuan());
            model.setDazhuanMajor(academicOrigin.getDazhuanMajor());
            model.setBenke(academicOrigin.getBenke());
            model.setBenkeMajor(academicOrigin.getBenkeMajor());
            model.setBenkeLevel(academicOrigin.getBenkeLevel());
            model.setShuoshi(academicOrigin.getShuoshi());
            model.setShuoshiMajor(academicOrigin.getShuoshiMajor());
            model.setShuoshiLevel(academicOrigin.getShuoshiLevel());
            model.setPhd(academicOrigin.getPhd());
            model.setPhdMajor(academicOrigin.getPhdMajor());
            model.setPhdLevel(academicOrigin.getPhdLevel());
            model.setAfterphd(academicOrigin.getAfterphd());
            model.setAfterphdLevel(academicOrigin.getAfterphdLevel());
        }
        return model;
    }
}